package com.example.myintent;

import android.R.string;
import android.os.Bundle;
import android.app.Activity;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;

public class Main extends Activity {

	private Button button;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        button = (Button)this.findViewById(R.id.button1);
        button.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				ClipboardManager clipboardManager = 
						(ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE);
//				String name = "jack";
				ClipData clipData = ClipData.newPlainText("label", "jack");
//				clipboardManager.setText(name);
			    clipboardManager.setPrimaryClip(clipData);
				Intent intent = new Intent(Main.this, OtherAct.class);
				startActivity(intent);
				
			}
		});
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
}
